﻿using System;
using System.Data;
using System.Data.Common;
using Hxj.Data;
using Hxj.Data.Common;

namespace Utility.Model
{
    /// <summary>
    /// 角色实体
    /// </summary>
    [Serializable]
    public class Sys_Role : Entity
    {
        /// <summary>
        /// 角色实体
        /// </summary>
        public Sys_Role()
            : base("Sys_Role")
        {
            this._RoleID = Guid.NewGuid().ToString();
            this._CreateDate = Utility.ConvertHelper.GetNowDateTime();
            this._IsDelete = false;
        }

        #region Model
        private string _RoleID;
        private string _RoleName;
        private string _RoleDes;
        private bool? _IsDelete;
        private DateTime? _CreateDate;
        private string _CreateUser;
        private bool? _IsAdmin;
        /// <summary>
        /// 
        /// </summary>
        public string RoleID
        {
            get { return _RoleID; }
            set
            {
                this.OnPropertyValueChange(_.RoleID, _RoleID, value);
                this._RoleID = value;
            }
        }
        /// <summary>
        /// 角色名称
        /// </summary>
        public string RoleName
        {
            get { return _RoleName; }
            set
            {
                this.OnPropertyValueChange(_.RoleName, _RoleName, value);
                this._RoleName = value;
            }
        }
        /// <summary>
        /// 角色描述
        /// </summary>
        public string RoleDes
        {
            get { return _RoleDes; }
            set
            {
                this.OnPropertyValueChange(_.RoleDes, _RoleDes, value);
                this._RoleDes = value;
            }
        }
        /// <summary>
        /// 是否删除
        /// </summary>
        public bool? IsDelete
        {
            get { return _IsDelete; }
            set
            {
                this.OnPropertyValueChange(_.IsDelete, _IsDelete, value);
                this._IsDelete = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? CreateDate
        {
            get { return _CreateDate; }
            set
            {
                this.OnPropertyValueChange(_.CreateDate, _CreateDate, value);
                this._CreateDate = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CreateUser
        {
            get { return _CreateUser; }
            set
            {
                this.OnPropertyValueChange(_.CreateUser, _CreateUser, value);
                this._CreateUser = value;
            }
        }
        /// <summary>
        /// 是否管理员
        /// </summary>
        public bool? IsAdmin
        {
            get { return _IsAdmin; }
            set
            {
                this.OnPropertyValueChange(_.IsAdmin, _IsAdmin, value);
                this._IsAdmin = value;
            }
        }
        #endregion

        #region Method
        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        public override Field[] GetPrimaryKeyFields()
        {
            return new Field[] {
				_.RoleID};
        }
        /// <summary>
        /// 获取列信息
        /// </summary>
        public override Field[] GetFields()
        {
            return new Field[] {
				_.RoleID,
				_.RoleName,
				_.RoleDes,
				_.IsDelete,
				_.CreateDate,
				_.CreateUser,
				_.IsAdmin};
        }
        /// <summary>
        /// 获取值信息
        /// </summary>
        public override object[] GetValues()
        {
            return new object[] {
				this._RoleID,
				this._RoleName,
				this._RoleDes,
				this._IsDelete,
				this._CreateDate,
				this._CreateUser,
				this._IsAdmin};
        }
        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        public override void SetPropertyValues(IDataReader reader)
        {
            this._RoleID = DataUtils.ConvertValue<string>(reader["RoleID"]);
            this._RoleName = DataUtils.ConvertValue<string>(reader["RoleName"]);
            this._RoleDes = DataUtils.ConvertValue<string>(reader["RoleDes"]);
            this._IsDelete = DataUtils.ConvertValue<bool?>(reader["IsDelete"]);
            this._CreateDate = DataUtils.ConvertValue<DateTime?>(reader["CreateDate"]);
            this._CreateUser = DataUtils.ConvertValue<string>(reader["CreateUser"]);
            this._IsAdmin = DataUtils.ConvertValue<bool?>(reader["IsAdmin"]);
        }
        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        public override void SetPropertyValues(DataRow row)
        {
            this._RoleID = DataUtils.ConvertValue<string>(row["RoleID"]);
            this._RoleName = DataUtils.ConvertValue<string>(row["RoleName"]);
            this._RoleDes = DataUtils.ConvertValue<string>(row["RoleDes"]);
            this._IsDelete = DataUtils.ConvertValue<bool?>(row["IsDelete"]);
            this._CreateDate = DataUtils.ConvertValue<DateTime?>(row["CreateDate"]);
            this._CreateUser = DataUtils.ConvertValue<string>(row["CreateUser"]);
            this._IsAdmin = DataUtils.ConvertValue<bool?>(row["IsAdmin"]);
        }
        #endregion

        #region _Field
        /// <summary>
        /// 字段信息
        /// </summary>
        public class _
        {
            /// <summary>
            /// * 
            /// </summary>
            public readonly static Field All = new Field("*", "Sys_Role");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field RoleID = new Field("RoleID", "Sys_Role", "RoleID");
            /// <summary>
            /// 角色名称
            /// </summary>
            public readonly static Field RoleName = new Field("RoleName", "Sys_Role", "角色名称");
            /// <summary>
            /// 角色描述
            /// </summary>
            public readonly static Field RoleDes = new Field("RoleDes", "Sys_Role", "角色描述");
            /// <summary>
            /// 是否删除
            /// </summary>
            public readonly static Field IsDelete = new Field("IsDelete", "Sys_Role", "是否删除");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field CreateDate = new Field("CreateDate", "Sys_Role", "CreateDate");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field CreateUser = new Field("CreateUser", "Sys_Role", "CreateUser");
            /// <summary>
            /// 是否管理员
            /// </summary>
            public readonly static Field IsAdmin = new Field("IsAdmin", "Sys_Role", "是否管理员");
        }
        #endregion


    }
}

